home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume24 / psroff3.0 / part03 < prev    next >
Encoding:
Internet Message Format  |  1991-10-09  |  55.2 KB

  1. Subject:  v24i098:  psroff, Troff to PostScript filter, Part03/19
  2. Newsgroups: comp.sources.unix
  3. Approved: rsalz@uunet.UU.NET
  4.  
  5. Submitted-by: Chris Lewis <clewis@ferret.ocunix.on.ca>
  6. Posting-number: Volume 24, Issue 98
  7. Archive-name: psroff3.o/part03
  8.  
  9. #! /bin/sh
  10. # This is a shell archive.  Remove anything before this line, then feed it
  11. # into a shell via "sh file" or similar.  To overwrite existing files,
  12. # type "sh file -c".
  13. # The tool that generated this appeared in the comp.sources.unix newsgroup;
  14. # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
  15. # Contents:  TROUBLE pk.c tests/ltest.m
  16. # Wrapped by clewis@ecicrl on Fri Apr  5 20:55:58 1991
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. echo If this archive is complete, you will see the following message:
  19. echo '          "shar: End of archive 3 (of 19)."'
  20. if test -f 'TROUBLE' -a "${1}" != "-c" ; then 
  21.   echo shar: Will not clobber existing file \"'TROUBLE'\"
  22. else
  23.   echo shar: Extracting \"'TROUBLE'\" \(22353 characters\)
  24.   sed "s/^X//" >'TROUBLE' <<'END_OF_FILE'
  25. X        Psroff 3.0 Trouble Shooting.... 2.11 91/04/02
  26. X
  27. X(psroff 1.0 users can use this to a certain extent.  This is relatively
  28. Xunchanged from Psroff 2.0 except for the ditroff input capability)
  29. X
  30. XThese are some pointers to possible solutions to problems with psroff.
  31. XAfter correcting a problem, you usually need to do:
  32. X
  33. X    make all
  34. X    su root
  35. X    make install
  36. X    make installwidths
  37. X
  38. XThis is assuming that you got clean compiles (you should be able
  39. Xto fix your own compile problems).
  40. X
  41. XUnless specified, the remarks in this file pertain to CAT troff input,
  42. Xnot ditroff input.
  43. X
  44. XIMPORTANT NOTE: MANY configuration difficulties can be detected
  45. Xby "make check".  If you do encounter a problem, I suggest that
  46. Xyou run "make check" first and correct any "ERROR"'s it reports
  47. Xthat apply to the configuration (driver/printer) you wish to use.
  48. XIf you encounter problems you cannot solve and wish to ask me for
  49. Xhelp, I will want you to send me a copy of "make check"'s output....
  50. X
  51. XDefinitions:
  52. X    - LIBDIR - default /usr/lib/troff2 (config option in Makefile)
  53. X      LJ drivers pick up font files from LIBDIR/lib/lj.
  54. X    - FONTDIR - by default "/usr/lib/font" (config option in Makefile).
  55. X      Must be /usr/lib/font unless you have a '-F' troff, see
  56. X      "width option" below.
  57. X    - "width tables".  psroff's install generates CAT compatible width
  58. X      tables and installs them into $FONTDIR/<widthname>/ft*, where
  59. X      "widthname" is a token denoting the "set" of widths.  Postscript
  60. X      printers (or ditroff driving postscript) use ps.  These are
  61. X      the only widths I distribute directly.  The Makefile will
  62. X      install widths into widthname "lj" if you have laserjet fonts
  63. X      installed in the right place.
  64. X
  65. X      With ditroff input, these width tables are only useful for
  66. X      the optimizer.
  67. X
  68. X    - "width option", most troff's support a way of telling it where
  69. X      to look for the width tables.  Some support -T<widthname> (Xenix
  70. X      f'r instance).  Others (Sun, Ultrix, most BSD's) specifically,
  71. X      need "-F<directory>/<widthname>/ftXX".  Check your
  72. X      man pages for troff.  This is should be specified by "trofftype"
  73. X      in lib/psroff.lib.S.  If you have a "-T" version of troff,
  74. X      FONTDIR *must* be /usr/lib/font.  If your troff supports neither
  75. X      -T or -F (some real old versions of Xenix, V7 perchance), you
  76. X      will have to install the width tables in FONTDIR directly and
  77. X      specify trofftype as "".  Which will also mean that you can
  78. X      only support one set of width tables.  (Unless you make binary
  79. X      patches to your troff)
  80. X
  81. X      In ditroff input, the trofftype is forced to be -T$width.
  82. X
  83. X    - "psroff debug" - rerun the psroff command, additionally specifying
  84. X      "-F" in the command line.  This permit's troff's stderr to be
  85. X      seen.  Correct any problems that it tells you about.  (eg:
  86. X      "width option").  If you see lines of the form:
  87. X        M<string>
  88. X      These are back-end directives and they're supposed to be
  89. X      there during psroff debug - ignore them.
  90. X    - HEADERSIZE: most troff's need an a.out.h header on the front
  91. X      of the width table files.  HEADERSIZE (defs.h) allows you to
  92. X      specify an arbitrary number of bytes on the front of the table
  93. X      in the width file.  Check /usr/lib/font/ftR (should be part
  94. X      of your original troff installation.  Is ftR 224 bytes long?
  95. X      If so, HEADERSIZE should be zero.  If not (eg: Ultrix,
  96. X      BSD's, some older Xenix, V7), you will have to specify
  97. X      HEADERSIZE.  SunOS, VAX/Ultrix wants 32.  (should be the size
  98. X      of an a.out header structure - od -c may give you some hints).
  99. X      Another way to tell is to run "file" on /usr/lib/font/ftR.
  100. X      Does it say "data"?  Then it probably needs HEADERSIZE 0.
  101. X      If it says "ascii" something, you're probably RISC/Ultrix, and you
  102. X      need ASCIIWIDTHS set.  If it says "executable" or "object" of some
  103. X      kind, you will have to set HEADERSIZE.
  104. X
  105. X      RISC/Ultrix uses an ASCII format width table.  You can
  106. X      tell this if the following command:
  107. X        echo ".fp 1 R" | troff -t > /dev/null
  108. X      says something about non-ascii /usr/lib/font/ftR.  If
  109. X      it does, define ASCIIWIDTHS.
  110. X
  111. X      If you're still having problems, use the "dumpft" trick
  112. X      shown below for Apollos.
  113. X
  114. X      HEADERSIZE can be left as 0 for use with ditroff input.
  115. X      (Eg: it only matters for CAT troff)
  116. X
  117. XNOTE for PSROFF 1.0 users:
  118. X
  119. X    psroff 1.0 does not have a psroff.lib file, so changes (eg:
  120. X    width option specifications) have to be made directly to
  121. X    the psroff.sh shell script.  Further, in the library, many of
  122. X    the files names are reversed - eg: lj.lib in release 2.0 is lib.lj
  123. X    in 1.0.
  124. X
  125. XMost initial problems are due to width table installation/specification -
  126. Xthis varies from system to system and is *very* confusing.  I'm sorry about
  127. Xthat, but there's no other way.  As a simple guide: if the /usr/lib/font/ftR
  128. Xfile in your original troff installation is not 224 bytes long, you *will*
  129. Xhave to set HEADERSIZE to something other than 0.
  130. X
  131. XAfter successful installation/testing, most problems are due to troff
  132. Xerrors that you don't get to see.
  133. X
  134. XTwo notes on HEADERSIZE/ASCIIWID/etc.:
  135. X    1) Some versions of troff will accept the -T option, but ignore
  136. X       it.  Eg: Apollo and SunOS.  If the widths don't seem right, try the -F
  137. X       option.  make check will usually tell you -F in this case.
  138. X    2) If /usr/lib/font/ftR is substantially larger than 224 bytes,
  139. X       ie, over 500 or 600, you probably have special headers.
  140. X       Eg: Apollos.  What you should do is type the following:
  141. X        cd utils
  142. X        ./dumpft -gv < /usr/lib/font/ftR | grep Guess
  143. X       Which will output a series of lines which contains both
  144. X       a HEADERSIZE guess, plus an error count.  The errorcount
  145. X       will have a minimum value, ideally zero.  Set
  146. X       the HEADERSIZE to the guess with the minimum error
  147. X       count and rebuild retry everything.  I won't attempt
  148. X       to supply these numbers for each of these systems because
  149. X       the number changes from release to release in some systems.
  150. X
  151. XBuild/Execute gross failures:
  152. X
  153. XShell scripts die horrible deaths:
  154. X
  155. X    Particularly with error messages from "test".  Does your "test"
  156. X    support -x?  If not, make sure that you've got SHELL and STARTSHELL
  157. X    set properly in the Makefile (The shell scripts assume V7 and/or USG
  158. X    versions of the Bourne Shell.  Older BSD and some BSD derivitives
  159. X    (aka Ultrix) need a USG compatible shell - look for "sh5" somewhere
  160. X    on your system).  ksh, bash and ash *should* work (untested).
  161. X    Theoretically, all of the shell scripts should work even without -x,
  162. X    but I've not really been able to test everything.
  163. X
  164. XThe makefile doesn't work:
  165. X
  166. X    This *assumes* System V compatible MAKE.  If the makefile blows
  167. X    (syntax errors in particular), search your system for a System V
  168. X    compatible version of make.  Ultrix: /usr/bin/s5make.  Gnumake should
  169. X    work fine.  Most Suns need a change here too.  You will probably
  170. X    have to:
  171. X    MAKE=<system 5 make> export MAKE
  172. X    <system 5 make>
  173. X    to build everything.
  174. X
  175. XPsroff seems to work, but nothing prints:
  176. X
  177. X    "Seems to work" meaning that the output file is > 15K or so
  178. X    in Postscript, or >1K with HP Laserjets when printing the test
  179. X    (make test).  A lot of these problems can be traced down to
  180. X    print spooler definition problems.  Some things to examine in
  181. X    your spooler filters (/etc/printcap in Suns, Ultrix, other BSD
  182. X    derivitives, or the /usr/spool/lp/interface files in System V lp
  183. X    spoolers):
  184. X    - If running Laserjet, make sure that 8-bit is set (stty cs8
  185. X      in System V).  *Some* extremely old systems (some V7's,
  186. X      some very old BSD's) aren't capable of supporting serial 8-bit.
  187. X      You might want to consider asking on comp.unix.questions or
  188. X      comp.unix.wizards about how to turn this on on non-System V's
  189. X      if you continue to have problems.  (I believe Chris Torek has
  190. X      a workaround for setting 8 bit on old BSDs)
  191. X    - If running laserjets, make sure that opost (SV) is off - you
  192. X      do *not* want the tty driver expanding tabs, cr's etc.
  193. X      Similar things apply with BSD derivitives.
  194. X    - Make sure that echo is *off*.  If it's on, postscript
  195. X      printing will die and say something about <something> (often
  196. X      "user@site") is an undefined command if you're looking at the
  197. X      diagnostics coming back up the serial line from the printer.
  198. X      Make sure that there isn't an "echo" in the stty of lp
  199. X      filters, or /etc/printcap.  It's probably safer to make
  200. X      it explicit by adding "-echo" in the appropriate place.
  201. X      This, for example, is a fragment of an /etc/printcap:
  202. X
  203. X        ps|HP LaserJet III with PostScript cartridge:\
  204. X        lp=/dev/ttyb:br#9600:\
  205. X        ms=clocal,-parity,cs8,-cstopb,-echo:\
  206. X        sh:sf:sd=/usr/spool/ps:tr=\f:lf=/usr/adm/lpd-errs:
  207. X
  208. XOperational problems:
  209. X
  210. XNEW INSTALL: No output, or output truncated (possibly after some really
  211. Xwild garble in the output):
  212. X
  213. X    Troff is probably exploding.  Run psroff debug - check in particular:
  214. X    for troff error messages about bad -T or -F options ("trofftype" see
  215. X    width tables and width option above) or not being able to find the
  216. X    width tables (did they really install?).  If troff is core-dumping,
  217. X    it's probably a HEADERSIZE (above) problem, but it's possibly a
  218. X    problem with the width of a specific character (Xenix doesn't
  219. X    like zero (or sometimes really narrow) characters - try
  220. X    tests/dumpft < <width table file> > /tmp/FOO and look for errors
  221. X    and really narrow (0 or 1 unit) characters.  Particularly \(ul/_/\(ru).
  222. X
  223. X    Other possibilities: bad output settings (ptr and lparg), bad
  224. X    troff input.
  225. X
  226. XNEW INSTALL: make test generates several blank pages plus bits of
  227. Xtext on Laserjets:
  228. X
  229. X    Chances are your HP Laserjet clone doesn't support incremental
  230. X    downloading.  Try undefining INCR and rebuilding.
  231. X
  232. XNEW INSTALL: the "6" is missing in the test page on the "16 point italic"
  233. Xand "16 point bold":
  234. X
  235. X    This is because you've not installed or properly configured more fonts
  236. X    than came with psroff, and psroff can't find a font close enough
  237. X    in size, and is letting the printer guess - and has selected a font
  238. X    that it had previously incrementally downloaded.
  239. X
  240. X    Get more fonts and make sure that lj.fonts is up-to-date with
  241. X    the font set you have.
  242. X
  243. XBoth NEW and OLD INSTALLS: truncated or possibly completely missing
  244. X    printjobs in Postscript.  Probably the printer has seen a syntax
  245. X    error or some such.  If you start up a "cat" from the device
  246. X    the printer is connected to, you can see the printer's error
  247. X    messages.
  248. X
  249. XWORKING INSTALL (eg: it's worked fine before): same symptoms as previous.
  250. X
  251. X    Troff is probably exploding, but probably not due to width tables.
  252. X    Run psroff debug.  Check for and correct troff error messages (eg:
  253. X    line too long) in your document.  This could even be troff not being
  254. X    able to find a file you specified to psroff.
  255. X
  256. XCharacter widths wildly and inconsistently off:
  257. X
  258. X    Probably HEADERSIZE.
  259. X
  260. XCharacter widths annoyingly, inconsistently, but not wildly off:
  261. X
  262. X    Remotely HEADERSIZE, more probably -T/-F trofftype omitted/wrong,
  263. X    or the width tables are simply wrong for the specific font or printer
  264. X    (you may want to experiment with the "width" option in lib/psroff.lib.S).
  265. X    Use "ps" for postscript printers and some others.
  266. X
  267. XCharacter widths uniformly off with ditroff:
  268. X
  269. X    - "-R" wrong or omitted in psroff.lib.S t2arg.  Check DESC file
  270. X      for proper value (default 300) and that the gfnttab log doesn't
  271. X      complain about a missing resolution during width table build.
  272. X    - DESC file has wrong resolution (default is 300).  Try adjusting.
  273. X      The ps widths use 720 (in DESC file)
  274. X    - width option.
  275. X
  276. XCharacter widths uniformly off with non-ditroff:
  277. X
  278. X    - wrong width tables - try using the right ones: check width option.
  279. X    - scaling bug in pk2ditwid/dit2catwid/gfnttab: contact me.
  280. X
  281. XA very few characters have bad widths:
  282. X
  283. X    - manually adjust the widths/width<widthname>/* files and
  284. X      cd utils; make widths; su root; make installwidths.
  285. X
  286. Xoutput wacko during a table (output possibly truncated):
  287. X
  288. X    run psroff debug - probably line too long (table too wide).
  289. X
  290. Xoutput looks pretty good, but wierd things happen in spots:
  291. X
  292. X    are you using ditroff features that CAT troff doesn't support?
  293. X    Eg: \S, \H, some "odd" permutations of \f, .ft, .fp?   Font
  294. X    numbers > 4 (in CAT troff)?  CAT Troff (and hence psroff) doesn't
  295. X    support them.  In ditroff-input mode, however, this can't happen.
  296. X
  297. XLooks good, but every second line has overstrikes at the end, the alternate
  298. Xlines are indented:
  299. X
  300. X    ".po" + ".ll" setting too high (CAT troff imposes 7.54" limit on total).
  301. X    Reduce ".po" and compensate with "-O" option to psroff.  I've had
  302. X    some rumors of *some* kinds of Xenix troff having a shorter maximum
  303. X    width.
  304. X
  305. XRight shifted when compared to ditroff/nroff/cat troff with packages
  306. Xother than psroff:
  307. X
  308. X    See -O option and macro adapter description for psroff.
  309. X
  310. XUtter garbage output:
  311. X
  312. X    Are you specifying the right driver?
  313. X
  314. XMM ".MT" macro doesn't appear to work properly:
  315. X
  316. X    If you use a special directive (".sR" or ".fp" as modified by
  317. X    the adapter macros) before ".MT", .MT will get buggered up.
  318. X    Sorry, no workaround (though most requests other than ".fp"
  319. X    can be issued by psroff -P options).  This isn't really a bug -
  320. X    a limitation of CAT troff's ability to pass additional directives
  321. X    to the backend without interfering with the typesetter state.
  322. X    Maybe one of these days I'll get around to figuring out a better
  323. X    mechanism.
  324. X
  325. XPage headers wrong or present on the first page when they shouldn't be:
  326. X
  327. X    See previous (replace ".MT" with page header macros in discussion).
  328. X
  329. Xline lengths a bit different from nroff/ditroff/other non-psroff CAT troff:
  330. X
  331. X    See macro adapter discussion in psroff/troff2ps man pages.
  332. X
  333. X".sR" doesn't appear to work at all:
  334. X
  335. X    Run psroff debug - do you see lines of the form "M<sR macro argument>"?
  336. X    If not, you probably didn't get the macro adapters properly initialized.
  337. X    psroff as distributed has adapters for MS, MM and MAN.  If you're
  338. X    using different ones, or invoking the macros by /usr/lib/tmac paths,
  339. X    or using no macros at all, the adapters and .sR definition won't be
  340. X    picked up.  You will have to hand-craft your own macro adapter using
  341. X    common.pre and common.post, using one of the example tmac's.
  342. X    (all in adapters/* in distribution or LIBDIR/adapters after install)
  343. X
  344. X    The .sR kludge isn't necessary for ditroff.
  345. X
  346. X".sR" causes breaks/font loads don't happen at the right time:
  347. X
  348. X    It has to unfortunately.  If you want to load fonts (.fp) during a line,
  349. X    *don't*.  Issue the ".fp"'s where it's safe to have a break.  Ditto
  350. X    other ".sR" directives.  There's no restrictions on changing to
  351. X    an *already loaded* font (eg: .ft directives).  The psroff -P option
  352. X    may help (not .fp's, sorry...).  Applies only to CAT troff input.
  353. X
  354. XSome things appear really wierd (eg: strings of character repeats
  355. Xin page number on MM headers):
  356. X
  357. X    Your CAT troff may not support \g (pure V7 troffs f'r instance).
  358. X    Experiment.  You may have to bugger around with the macros to
  359. X    remove dependence on \g.  (which is supposed to return a code
  360. X    denoting the output format of a number register, and is usually
  361. X    used to determine whether a number register has ever been set)
  362. X
  363. XME macros don't seem to work:
  364. X
  365. X    A friend noted:
  366. X
  367. X    In order to make them useable, I had to modify them somewhat.  The
  368. X    problem was with the following syntax:
  369. X
  370. X    .if t \
  371. X    \{
  372. X    .    zz
  373. X    .\}
  374. X
  375. X    Our (Xenix) troff required the following instead:
  376. X
  377. X    .if t \{\
  378. X    .    zz
  379. X    .\}
  380. X
  381. X    This was required for all occurances of "\{".  It seems "\{" MUST
  382. X    terminate a line, and MUST be followed by a "\<NEWLINE>".  Even a ".\{"
  383. X    didn't help any.
  384. X
  385. XEverything okay, but some characters missing (or wrong) on output:
  386. X(ditroff drivers may complain about characters not found)
  387. X
  388. X    Chances are that your printer or set of fonts doesn't support
  389. X    that character.  Postscript driving should be perfect.  Some
  390. X    ditroff drivers don't have character sets that are a superset
  391. X    of CAT troff.  There are a few minor problems with LJ character
  392. X    sets.  psdit, xproof, xtroff are missing a few CAT characters.
  393. X    You may be able to resolve these by adding translation overrides
  394. X    to the appropriate *.fonts file (see jt.fonts for examples).
  395. X    Some ditroff's have different meanings for the same character
  396. X    spec.  ("@" in some ditroff drivers is a different character)
  397. X
  398. XMy ditroff driver dies with errors about lines starting with "#":
  399. X
  400. X    define NOCHATTER.
  401. X
  402. XMy postscript printer server gets upset:
  403. X
  404. X    define NOCHATTER
  405. X
  406. XI get postscript printer errors on last page, or last page missing:
  407. X
  408. X    Have you got a DEC LN03 or some other printer that doesn't
  409. X    like trailing control-D's?  Define "NOCONTROLD" in defs.h
  410. X
  411. XDitroff driver doesn't work/gives errors:
  412. X
  413. X    check, recheck, and check again for ditroff backend config
  414. X    (lparg/ptr in psroff.lib.S).  Try "psroff -t" and then
  415. X    hand feeding the stdout to your backend manually.  Experiment
  416. X    with "-d" setting in t2arg in psroff.lib.S.  If related
  417. X    to specific characters, maybe adding translation overrides
  418. X    in the appropriate *.fonts file will help
  419. X
  420. XDitroff input (-N) doesn't work/gives errors:
  421. X
  422. X    Particularly remarks about not knowing about specific characters.
  423. X    That's because the psroff tables don't match ditroff's.
  424. X    Make sure that the extension section of the appropriate
  425. X    *.fonts file is in agreement with your ditroff width tables.
  426. X    cd widths; make extensions to rebuild these tables to tack
  427. X    onto the end of the appropriate *.fonts file.
  428. X
  429. XLaserjet printers get confused and loses settings (eg: copy count etc)
  430. X
  431. X    Be aware of the fact that lj.lib has a RESET command.  If you
  432. X    have some sort of spooler that's emitting commands to the printer
  433. X    outside of the control of psroff (eg: copy count set before
  434. X    psroff output), you may have to change it.
  435. X
  436. XLaserjet: wrong font selection (particularly when the result is
  437. X10 point Courier), troff2ps compaining that it can't find a font
  438. Xfile:
  439. X
  440. X    - lj.fonts incorrect.
  441. X    - Don't have any good font files - buy some good ROMAN8's for
  442. X      Roman, Italic and Bold, or use TeX fonts and "make buildljfonts".
  443. X
  444. XLaserjet: sizes of characters are wrong, some characters missing, wrong
  445. X    font selected.
  446. X
  447. X    - Get some decent fonts.  If you don't have the right size (within
  448. X      a few points) or font available, psroff will get the printer
  449. X      to select a font.  Which will usually look wrong.  Further, if
  450. X      the printer selects a font that has been incrementally downloaded,
  451. X      some characters may be missing on the output.  If you've not
  452. X      gotten any additional fonts, "make test" will show an example
  453. X      of this problem, in that the line supposedly 16 point will
  454. X      be the wrong size and some characters will be missing (italic
  455. X      and bold "6")
  456. X
  457. XLaserjet: lousey/wrong/missing characters (non-S font):
  458. X
  459. X    - You got crummy fonts.  Go buy or steal some good ROMAN8's in Roman,
  460. X      Italic and Bold at CAT troff's supported point sizes.
  461. X      TeX's PK fonts will work, but non-alphanumeric characters will
  462. X      often be wrong (particularly box drawing and backslash).
  463. X    - Get a HP or Adobe Postscript cartridge.  (The Pacific Page does work
  464. X      fine, except for reports that at least some of them use slightly
  465. X      different fonts, and the widths will be off).
  466. X
  467. XMy laserjet stalls, gives "too complex" messages, doesn't switch fonts
  468. Xsometimes:
  469. X
  470. X    - Some HPLJ clones don't support incremental downloading.  undefine
  471. X      INCR and try again.  Plain laserjets (the old ones) don't support
  472. X      font downloading at all.  Sigh...
  473. X    - Ran out of memory - (INCR on): simplify document to use less fonts
  474. X      or reduce MDLF.
  475. X    - Ran out of memory - (INCR and PARTIAL off): turn on PARTIAL
  476. X    - Too many fonts previously loaded - adjust PRELOAD.
  477. X    - double check MDLF.
  478. X
  479. XManual pages look great except the page footers are at the top of the
  480. Xnext page.  MM and MS work fine.
  481. X
  482. X    - You're IBM AIX right?  Sigh....  The man macros in AIX explicitly
  483. X      set page length to something other than 11 inches.  Supply
  484. X      "-rM1" to psroff, and the macros will select 11 inches.  Or,
  485. X      you could insert a ".nr M 1" the beginning of adapters/tmac.an.
  486. X
  487. XSQTroff ditroff backend sometimes barfs on psroff ditroff output:
  488. X
  489. X    It do do that don't it?  SQTroff ditroff format is apparently
  490. X    slightly different.  Then again, if you got SQTroff, why you have
  491. X    psroff?
  492. X
  493. Xxproof sometimes dies with "too many font" messages:
  494. X
  495. X    - AT&T's fault.  (Each symbol character is a separate font, xproof
  496. X      is configured for a maximum of 50 or so fonts... duh...)
  497. X
  498. XThe Bell Symbol (\(bs) isn't:
  499. X
  500. X    It ain't supposed to be.
  501. X
  502. XPsroff is wonderful:
  503. X
  504. X    Of course.  Didn't I say it would be? ;-)
  505. X
  506. XTEST SHEET INTERPRETATION:
  507. X
  508. X    If you see problems after running the test sheet, here are a few
  509. X    suggestions:
  510. X
  511. X    - Laserjet output: *badly* splattered, most characters unrecognizeable
  512. X      and probably more than one or two pages: If you're not using a Hewlett
  513. X      Packard Laserjet, try undefining INCR and rebuilding.  Some clones won't
  514. X      handle incremental downloading.  Other possibilities: if you are
  515. X      printing via serial line, make sure that the serial line is 8 bit raw
  516. X      (eg: cs8 and -opost on System V, or CBREAK mode in BSD)
  517. X      Check /etc/printcap or /usr/spool/lp/interface/*.
  518. X    - Character spacing objectionably off in the text portions - some
  519. X      versions of troff, such as SunOS, do not support trofftype "-T$width",
  520. X      but they don't complain about it.  Try the -F variant.
  521. X      If you're manually invoking troff (ala "troff.... | troff2ps"),
  522. X      you probably aren't picking up the common.pre macro adapter that
  523. X      tells troff to reload its fonts from psroff's versions rather than
  524. X      their own built-ins.  Another symptom I've seen is floating point
  525. X      exceptions or the long horizontal lines in the table consisting
  526. X      of one _ character around the middle of the line.
  527. X    - Postscript doesn't print - probably you have echo set on your
  528. X      serial line.  Turn it *off*.  Alternately, maybe your printer
  529. X      doesn't want to see control-D's - see the discussion in
  530. X      troff2ps(n)
  531. X    - Laserjet: the "6" is missing in the test page on the "16 point italic"
  532. X      and "16 point bold".  You don't have enough fonts, or they're not
  533. X      configured properly.
  534. END_OF_FILE
  535.   if test 22353 -ne `wc -c <'TROUBLE'`; then
  536.     echo shar: \"'TROUBLE'\" unpacked with wrong size!
  537.   fi
  538.   # end of 'TROUBLE'
  539. fi
  540. if test -f 'pk.c' -a "${1}" != "-c" ; then 
  541.   echo shar: Will not clobber existing file \"'pk.c'\"
  542. else
  543.   echo shar: Extracting \"'pk.c'\" \(21627 characters\)
  544.   sed "s/^X//" >'pk.c' <<'END_OF_FILE'
  545. X/*
  546. X    Copyright 1985, 1986, 1987, 1988, 1989, 1990, 1991 Chris Lewis
  547. X        All Rights Reserved
  548. X
  549. X    See the LICENSE file for a full description of restrictions under which
  550. X    this software is provided.
  551. X
  552. X    Function: PK and SFP font reading and emission functions
  553. X */
  554. X
  555. X#include "defs.h"
  556. X
  557. X#ifdef    PK
  558. X
  559. X#ifndef lint
  560. Xstatic char SCCSid[] = "@(#)pk.c 2.3 Copyright 91/02/20 09:02:17 Chris Lewis";
  561. X#endif
  562. X
  563. X#define    DRAW
  564. X#define    OUTRES    300
  565. X
  566. X#include "pk.h"
  567. X
  568. X#if    defined(PARTIAL)
  569. X#include "pkc.h"
  570. Xstruct needmaps *needmaps = (struct needmaps *) NULL;
  571. X#endif
  572. X
  573. Xextern char *progname;
  574. X
  575. Xstatic FILE *fin;
  576. Xstatic char *filename;    /* name of *current* font being read */
  577. Xextern char *malloc();
  578. X
  579. Xstatic long flag_byte;
  580. Xstatic repeatcount;
  581. Xstatic dyn_f;
  582. X
  583. Xstatic readraster();
  584. X
  585. Xstatic long
  586. Xget1int() { return(getc(fin)); }
  587. X
  588. Xstatic long
  589. Xget2int() {
  590. X    register long c;
  591. X    c = get1int();
  592. X    c = (c<<8) | (0xff & get1int());
  593. X    return(c);
  594. X}
  595. X
  596. Xstatic long
  597. Xget4int() {
  598. X    register long c;
  599. X    c = get2int();
  600. X    c = (c << 16) | (0xffff & get2int());
  601. X    return(c);
  602. X}
  603. X
  604. Xstatic long
  605. Xget3int() {
  606. X    register long c;
  607. X    c = get2int();
  608. X    c = (c << 8) | (0xff & get1int());
  609. X    return(c);
  610. X}
  611. X
  612. X#ifdef VFPRINTF
  613. X#include <varargs.h>
  614. X/* VARARGS */
  615. Xpkmsg(va_alist)
  616. Xva_dcl
  617. X{
  618. X    va_list args;
  619. X    char *fmt;
  620. X
  621. X    va_start(args);
  622. X    fmt = (char *) va_arg(args, char *);
  623. X    VFPRINTF(stderr, fmt, args);
  624. X    va_end(args);
  625. X}
  626. X#else
  627. X/* VARARGS1 ARGSUSED */
  628. Xpkmsg(fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
  629. Xchar    *fmt;
  630. Xint    a1, a2, a3, a4, a5, a6, a7, a8, a9, a10; {
  631. X    char buf[BUFSIZ];
  632. X    sprintf(buf, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
  633. X    fprintf(stderr, buf);
  634. X}
  635. X#endif
  636. X
  637. Xstatic
  638. Xskipspecials() {
  639. X    register int i,c;
  640. X    do {
  641. X    flag_byte = getc(fin);
  642. X    if (flag_byte >= 240) {
  643. X        i = 0;
  644. X        switch(flag_byte) {
  645. X        case PK_xxx4:
  646. X            i = (i << 8) + getc(fin);
  647. X        case PK_xxx3:
  648. X            i = (i << 8) + getc(fin);
  649. X        case PK_xxx2:
  650. X            i = (i << 8) + getc(fin);
  651. X        case PK_xxx1:
  652. X            i = (i << 8) + getc(fin);
  653. X            DBP((D_PK, "PK_xxx%d: ", flag_byte - PK_xxx1 + 1));
  654. X            while(i--) {
  655. X            c = getc(fin);
  656. X            DBP((D_PK, "%c", c));
  657. X            }
  658. X            DBP((D_PK, "\n"));
  659. X            break;
  660. X        case PK_yyy:
  661. X            i = get4int();
  662. X            DBP((D_PK, "Num special: %d\n", i));
  663. X            break;
  664. X        case PK_post:
  665. X            DBP((D_PK, "Postamble\n"));
  666. X            break;
  667. X        case PK_no_op:
  668. X            DBP((D_PK, "No-op\n"));
  669. X            break;
  670. X        default:
  671. X            pkmsg("PK file %s: Unexpected %ld\n", filename,
  672. X            flag_byte);
  673. X            exit(1);
  674. X        }
  675. X    }
  676. X    } while (flag_byte >= 240 && flag_byte != PK_post);
  677. X}
  678. X
  679. Xstatic
  680. Xreadschar(p)
  681. Xstruct pkc *p; {
  682. X    p->pkc_pl = get1int() + ((p->pkc_flag&0x3) << 8);
  683. X    p->pkc_char = get1int();
  684. X    p->pkc_tfm = get3int();
  685. X    p->pkc_dx = get1int() * pow2(16);
  686. X    p->pkc_dy = 0;
  687. X    p->pkc_width = get1int();
  688. X    p->pkc_height = get1int();
  689. X    p->pkc_x_off = get1int();
  690. X    p->pkc_y_off = get1int();
  691. X    if (p->pkc_x_off > 127)
  692. X    p->pkc_x_off -= 256;
  693. X    if (p->pkc_y_off > 127)
  694. X    p->pkc_y_off -= 256;
  695. X    p->pkc_rlen = p->pkc_pl - 8;
  696. X    readraster(p);
  697. X}
  698. X
  699. Xstatic
  700. Xreadeschar(p)
  701. Xstruct pkc *p; {
  702. X    p->pkc_pl = get2int() + ((p->pkc_flag&0x3) << 16);
  703. X    p->pkc_char = get1int();
  704. X    p->pkc_tfm = get3int();
  705. X    p->pkc_dx = get2int() * pow2(16);
  706. X    p->pkc_dy = 0;
  707. X    p->pkc_width = get2int();
  708. X    p->pkc_height = get2int();
  709. X    p->pkc_x_off = get2int();
  710. X    p->pkc_y_off = get2int();
  711. X    if (p->pkc_x_off > 32767)
  712. X    p->pkc_x_off -= 65536;
  713. X    if (p->pkc_y_off > 32767)
  714. X    p->pkc_y_off -= 65536;
  715. X    p->pkc_rlen = p->pkc_pl - 13;
  716. X    readraster(p);
  717. X}
  718. X
  719. Xstatic
  720. Xreadlchar(p)
  721. Xstruct pkc *p; {
  722. X    p->pkc_pl = get4int();
  723. X    p->pkc_char = get4int();
  724. X    p->pkc_tfm = get4int();
  725. X    p->pkc_dx = get4int();
  726. X    p->pkc_dy = get4int();
  727. X    p->pkc_width = get4int();
  728. X    p->pkc_height = get4int();
  729. X    p->pkc_x_off = get4int();
  730. X    p->pkc_y_off = get4int();
  731. X    p->pkc_rlen = p->pkc_pl - 28;
  732. X    readraster(p);
  733. X}
  734. X
  735. Xstatic
  736. Xreadraster(p)
  737. Xstruct pkc *p; {
  738. X    p->pkc_pkr = (int8 *) mustmalloc((int) p->pkc_rlen, filename);
  739. X    fread((char *) p->pkc_pkr, 1, (int) p->pkc_rlen, fin);
  740. X}
  741. X
  742. X/*    Read a character sequence from a PK file */
  743. Xstatic struct pkc *
  744. Xrpkc() {
  745. X    register struct pkc *p = (struct pkc *) mustmalloc(sizeof(struct pkc),
  746. X    filename);
  747. X
  748. X    p->pkc_pkr = NULL;
  749. X    p->pkc_sfpr = NULL;
  750. X    p->pkc_flag = flag_byte;
  751. X    p->pkc_dyn_f = p->pkc_flag >> 4;
  752. X    flag_byte &= 0x7;
  753. X
  754. X    if (flag_byte == 7)
  755. X    readlchar(p);
  756. X    else if (flag_byte > 3)
  757. X    readeschar(p);
  758. X    else
  759. X    readschar(p);
  760. X    return(p);
  761. X}
  762. X
  763. X#ifdef    SFP
  764. X/*    Read a character sequence from an SFP */
  765. Xstatic struct pkc *
  766. Xrsfpc() {
  767. X    register struct pkc *p;
  768. X    int len;
  769. X
  770. X    if ((len = getc(fin)) == EOF || len != '\033') {
  771. X    /* HP fonts when loaded often have trailing nulls due to DOS
  772. X       file padding.  Screech on non-null */
  773. X    if (len && len != EOF)
  774. X        fprintf(stderr,
  775. X        "%s: WARNING: trailing garbage in %s, offset %ld, char 0x%02x\n",
  776. X        progname, filename, ftell(fin), len);
  777. X    flag_byte = PK_post;
  778. X    return((struct pkc *) NULL);
  779. X    }
  780. X
  781. X    p = (struct pkc *) mustmalloc(sizeof(struct pkc), filename);
  782. X    p->pkc_pkr = NULL;
  783. X    p->pkc_sfpr = NULL;
  784. X    p->pkc_flag = 0;
  785. X    p->pkc_dyn_f = 0;
  786. X
  787. X    if (fscanf(fin, "*c%ldE", &(p->pkc_char)) != 1) {
  788. X    pkmsg("SFP file: %s, bad/missing SET CHAR CODE, offset: %ld\n",
  789. X        filename, ftell(fin));
  790. X    exit(1);
  791. X    }
  792. X
  793. X    if (fscanf(fin, "\033(s%dW", &len) != 1 || len < 16) {
  794. X    pkmsg("SFP file: %s, bad/missing/tooshort CHAR DOWNLOAD sequence\n",
  795. X        filename);
  796. X    exit(1);
  797. X    }
  798. X
  799. X    get4int();    /* skip some garbage */
  800. X    get2int();    /* skip more garbage (actually, orientation & dummy */
  801. X
  802. X    p->pkc_x_off = get2int();
  803. X    if (p->pkc_x_off > 32767)
  804. X    p->pkc_x_off -= 65536;
  805. X    p->pkc_x_off = -p->pkc_x_off;
  806. X    p->pkc_y_off = get2int();
  807. X    if (p->pkc_y_off > 32767)
  808. X    p->pkc_y_off -= 65536;
  809. X    p->pkc_width = get2int();
  810. X    p->pkc_height = get2int();
  811. X    p->pkc_dx = get2int() * pow2(16) / 4;
  812. X
  813. X    p->pkc_sfpr = (struct ras *) mustmalloc(sizeof(struct ras), filename);
  814. X
  815. X    p->pkc_sfpr->ras_height = p->pkc_height;
  816. X    p->pkc_sfpr->ras_width = p->pkc_width;
  817. X    p->pkc_sfpr->ras_bline = (p->pkc_width + 7) / 8;
  818. X    p->pkc_sfpr->ras_bytes = p->pkc_sfpr->ras_height * p->pkc_sfpr->ras_bline;
  819. X    if (p->pkc_sfpr->ras_bytes) {
  820. X    p->pkc_sfpr->ras_raster = (int8 *) mustmalloc((int)
  821. X        p->pkc_sfpr->ras_bytes, filename);
  822. X
  823. X    fread((char *) p->pkc_sfpr->ras_raster, (int) p->pkc_sfpr->ras_bytes,
  824. X        1, fin);
  825. X    } else {
  826. X    free((char *) p->pkc_sfpr);
  827. X    p->pkc_sfpr = NULL;
  828. X    }
  829. X
  830. X    return(p);
  831. X}
  832. X#endif
  833. X
  834. Xstatic struct pkc *
  835. Xreadchar(p)
  836. Xstruct pkp *p; {
  837. X    if (p->pkp_flags&PK_PK)
  838. X    return(rpkc());
  839. X#ifdef    SFP
  840. X    else if (p->pkp_flags&PK_SFP)
  841. X    return(rsfpc());
  842. X#endif
  843. X    else
  844. X    return((struct pkc *) NULL);
  845. X}
  846. X
  847. Xstatic int
  848. Xpkccomp(a, b)
  849. Xstruct pkc **a, **b; {
  850. X    if ((*a)->pkc_char < (*b)->pkc_char)
  851. X    return(-1);
  852. X    else
  853. X    return(1);
  854. X    /* can't be equal! */
  855. X}
  856. X
  857. Xstatic
  858. Xrastbit(x,y,r)
  859. Xregister int x, y;
  860. Xregister struct ras *r; {
  861. X    register int bi = y * r->ras_bline + (x >> 3);
  862. X
  863. X    /* You don't really want to uncomment this.... ;-) */
  864. X    /*    printf("x,y,bi: %d,%d,%d\n", x, y, bi);*/
  865. X    return(r->ras_raster[bi] & (0x80 >> (x&7)));
  866. X}
  867. X
  868. Xstatic int8 *rptr;
  869. Xstatic long bitweight;
  870. X
  871. Xgetnyb() {
  872. X    register int8 b;
  873. X    if (!bitweight) {
  874. X    bitweight = 8;
  875. X    rptr++;
  876. X    }
  877. X    b = *rptr;
  878. X    bitweight -= 4;
  879. X#ifdef    VDEBUG
  880. X    DBP((D_PK, "getnyb byte: %x\n", b));
  881. X    DBP((D_PK, "getnyb: %x\n", (b >> bitweight) & 0xf));
  882. X#endif
  883. X    return((b >> bitweight)&0xf);
  884. X}
  885. X
  886. X#ifdef    NEVER
  887. Xgetbit() {
  888. X    register int8 b;
  889. X    if (!bitweight) {
  890. X    bitweight = 8;
  891. X    rptr++;
  892. X    }
  893. X    b = *rptr;
  894. X    bitweight--;
  895. X    return((b>>bitweight)&1);
  896. X}
  897. X#endif
  898. X
  899. X/*    Dumps an ASCII version of the SFP raster r, to line n.
  900. X    Normally only for debugging, but is also used from pktype
  901. X */
  902. X
  903. Xdumpr(r, n)
  904. Xstruct ras *r;
  905. Xint n; {
  906. X    int x, y;
  907. X    if (!diagFile)
  908. X    return;
  909. X    fprintf(diagFile, "\n");
  910. X    for (y = 0; y < n; y++) {
  911. X    fprintf(diagFile, "%3d  ", y);
  912. X    for (x = 0; x < r->ras_width; x++) {
  913. X        if (rastbit(x, y, r))
  914. X        putc('*', diagFile);
  915. X        else
  916. X        putc(' ', diagFile);
  917. X    }
  918. X    putc('\n', diagFile);
  919. X    }
  920. X}
  921. X
  922. Xstatic long
  923. Xpkpack(pc,r)
  924. Xregister struct pkc *pc;
  925. Xregister struct ras *r; {
  926. X    long i, j;
  927. X    long pkpackret;
  928. X    i = getnyb();
  929. X    if (i == 0) {
  930. X    do {
  931. X        j = getnyb();
  932. X        i++;
  933. X    } while(!j);
  934. X    while(i--)
  935. X        j = (j << 4) + getnyb();
  936. X    pkpackret = (j - 15 + (13 - dyn_f) * 16 + dyn_f);
  937. X    } else if (i <= dyn_f)
  938. X    pkpackret = (i);
  939. X    else if (i < 14)
  940. X    pkpackret = ((i - dyn_f - 1)*16 + getnyb() + dyn_f + 1);
  941. X    else {
  942. X    if (repeatcount) {
  943. X        pkmsg("Second repeat count for this row!\n");
  944. X        exit(1);
  945. X    }
  946. X    if (i == 14)
  947. X        repeatcount = pkpack(pc,r);
  948. X    else
  949. X        repeatcount = 1;
  950. X    /*sendout(1, repeatcount, pc, r);*/
  951. X    pkpackret = (pkpack(pc,r));
  952. X    }
  953. X    if (pkpackret < 1) {
  954. X    pkmsg("pkpack returned < 1! (%s)", filename);
  955. X    exit(1);
  956. X    }
  957. X    return(pkpackret);
  958. X}
  959. X
  960. Xstatic
  961. Xgetpbits(pc, r)
  962. Xregister struct pkc *pc;
  963. Xregister struct ras *r; {
  964. X    register int h_bit        = pc->pkc_width,
  965. X         count,
  966. X         turnon;
  967. X    turnon = pc->pkc_flag&0x8;
  968. X    dyn_f = pc->pkc_dyn_f;
  969. X    repeatcount = 0;
  970. X    r->ras_xcur = r->ras_ycur = 0;
  971. X    while(r->ras_ycur < pc->pkc_height) {
  972. X    count = pkpack(pc,r);
  973. X    while(count > 0) {
  974. X        if (count >= h_bit) {
  975. X        count -= h_bit;
  976. X        while(h_bit--) {
  977. X            if (turnon)
  978. X            r->ras_raster[r->ras_ycur*r->ras_bline + (r->ras_xcur>>3)]
  979. X                |= (0x80 >> (r->ras_xcur&7));
  980. X            r->ras_xcur++;
  981. X        }
  982. X        r->ras_ycur++;
  983. X        r->ras_xcur = 0;
  984. X        while(repeatcount --) {
  985. X#ifdef    VDEBUG
  986. X            DBP((D_PK, "Copy line %d to %d\n", r->ras_ycur,
  987. X            r->ras_ycur-1));
  988. X#endif
  989. X            memcpy((char*)&(r->ras_raster[r->ras_ycur * r->ras_bline]),
  990. X               (char*)&(r->ras_raster[(r->ras_ycur - 1) *
  991. X                   r->ras_bline]),
  992. X               (int) r->ras_bline);
  993. X            r->ras_ycur++;
  994. X        }
  995. X        repeatcount = 0;
  996. X        h_bit = pc->pkc_width;
  997. X        } else {
  998. X        h_bit -= count;
  999. X        while(count--) {
  1000. X            if (turnon)
  1001. X            r->ras_raster[r->ras_ycur*r->ras_bline +
  1002. X                (r->ras_xcur>>3)] |= (0x80 >> (r->ras_xcur&7));
  1003. X            r->ras_xcur++;
  1004. X        }
  1005. X        count = 0;
  1006. X        }
  1007. X    }
  1008. X    turnon = !turnon;
  1009. X    }
  1010. X    if (r->ras_ycur != pc->pkc_height ||
  1011. X    h_bit != pc->pkc_width)
  1012. X    pkmsg("Bad bit somehow (%s)\n", filename);
  1013. X}
  1014. X
  1015. Xstatic
  1016. Xgetrbits(pc, r)
  1017. Xregister struct pkc *pc;
  1018. Xregister struct ras *r; {
  1019. X    register int x, y;
  1020. X    register int bit = 0;
  1021. X    for (y = 0; y < pc->pkc_height; y++) {
  1022. X    for (x = 0; x < pc->pkc_width; x++) {
  1023. X        if (pc->pkc_pkr[bit >> 3] & (0x80 >> (bit&7)))
  1024. X        r->ras_raster[y*r->ras_bline + (x>>3)] |= (0x80 >> (x&7));
  1025. X        bit++;
  1026. X    }
  1027. X    }
  1028. X}
  1029. X
  1030. X/*    Convert a PK raster to an unpacked SFP version.
  1031. X    (If there's already an SFP version, it's returned instead)
  1032. X */
  1033. Xstruct ras *
  1034. Xpkrast(pc)
  1035. Xstruct pkc *pc; {
  1036. X    register struct ras *r;
  1037. X    if (pc->pkc_sfpr)
  1038. X    return(pc->pkc_sfpr);
  1039. X    if (!pc->pkc_rlen)
  1040. X    return(NULL);
  1041. X
  1042. X    pc->pkc_sfpr = r = (struct ras *) mustmalloc(sizeof(struct ras),
  1043. X    filename);
  1044. X
  1045. X    r->ras_height = pc->pkc_height;
  1046. X    r->ras_width = pc->pkc_width;
  1047. X    r->ras_bline = (pc->pkc_width + 7) / 8;
  1048. X    r->ras_bytes = r->ras_height * r->ras_bline;
  1049. X    r->ras_raster = (int8 *) mustmalloc((int) r->ras_bytes, filename);
  1050. X
  1051. X    /* initialize bit unpackers */
  1052. X    rptr = pc->pkc_pkr;
  1053. X    bitweight = 8;
  1054. X
  1055. X    /* calculate bits here...*/
  1056. X    if (pc->pkc_dyn_f == 14)
  1057. X    getrbits(pc, r);
  1058. X    else
  1059. X    getpbits(pc, r);
  1060. X    return(r);
  1061. X}
  1062. X
  1063. X/*    Read a PK font file header */
  1064. Xstatic struct pkp *
  1065. Xpk_rpk(p)
  1066. Xregister struct pkp *p; {
  1067. X    register int i,c;
  1068. X
  1069. X    if (getc(fin) != 89) {
  1070. X    pkmsg("PK file %s: Wrong version of packed file!\n", filename);
  1071. X    exit(1);
  1072. X    }
  1073. X    i = getc(fin);
  1074. X    if (i > 0) {
  1075. X    DBP((D_PK, "PKVersion: "));
  1076. X    while (i--) {
  1077. X        c = getc(fin);
  1078. X        DBP((D_PK, "%c", c));
  1079. X    }
  1080. X    DBP((D_PK, "\n"));
  1081. X    }
  1082. X    p->pkp_bmax = 0;
  1083. X    p->pkp_dmax = 0;
  1084. X    p->pkp_wmax = 0;
  1085. X    p->pkp_xomax = 0;
  1086. X    p->pkp_ds = get4int();
  1087. X    p->pkp_cs = get4int();
  1088. X    p->pkp_hppp = get4int();
  1089. X    p->pkp_vppp = get4int();
  1090. X
  1091. X    if (p->pkp_hppp != p->pkp_vppp)
  1092. X    pkmsg("PK file %s: Warning aspect ratio not 1:1\n", filename);
  1093. X    p->pkp_res = (double) p->pkp_hppp * POINT / pow2(16) + .5;
  1094. X    p->pkp_npts = ((double) p->pkp_ds / pow2(20)) *
  1095. X    ((double) p->pkp_res / OUTRES) + .5;
  1096. X    p->pkp_chars = (struct pkc *) NULL;
  1097. X    p->pkp_last = (struct pkc *) NULL;
  1098. X    p->pkp_num = 0;
  1099. X    p->pkp_list = (struct pkc **) NULL;
  1100. X
  1101. X    /*    Try to guess symset, style, stroke weight and typeface
  1102. X    These aren't particularly important, but it assists the LJ
  1103. X    if it's trying to select one of these via characteristic.
  1104. X    This will only work if the file name reflects the Troff name,
  1105. X    according to the following conventions:
  1106. X
  1107. X    filename: {<path>/}troffname.pointsize.[pk|sfp]
  1108. X
  1109. X    All ROMAN8 encodings unless MATH8.
  1110. X    All 0 strokeweight, unless Bold.
  1111. X    All upright, unless Italic
  1112. X    All Roman typeface, unless otherwise specified
  1113. X
  1114. X        R    : Normal Roman
  1115. X        I    : Italic
  1116. X        B    : Bold
  1117. X        S    : MATH8 Symbol
  1118. X        X    : Bold italic
  1119. X        .X    : <typeface> Bold italic
  1120. X        .I    : <typeface> Italic
  1121. X        .B    : <typeface> Bold
  1122. X        .R    : <typeface> Normal
  1123. X        H or H.    : Helvetica typeface
  1124. X        C or C.    : Courier typeface
  1125. X              typefaces should be extended.
  1126. X     */
  1127. X
  1128. X    {
  1129. X    register char *fp;
  1130. X    register int char1, char2, italic, bold, bolditalic, onechar;
  1131. X
  1132. X    fp = strrchr(filename, '/');
  1133. X    if (!fp)
  1134. X        fp = filename;
  1135. X    else
  1136. X        fp++;
  1137. X
  1138. X    /* Default settings */
  1139. X    p->pkp_symset = (8 << 5) - 64 + 'U';    /* ROMAN 8 */
  1140. X    p->pkp_style = 0;    /* upright */
  1141. X    p->pkp_sw = 0;        /* stroke 0 */
  1142. X    p->pkp_typeface = 5;    /* typeface Roman */
  1143. X
  1144. X    char1 = *fp++;
  1145. X    onechar = (*fp == '.');
  1146. X
  1147. X    if (char1 == 'S' && onechar)
  1148. X        p->pkp_symset = (8 << 5) - 64 + 'M';    /* MATH 8 */
  1149. X    else {
  1150. X
  1151. X        char2 = *fp;
  1152. X
  1153. X        italic = ((onechar && char1 == 'I') || char2 == 'I');
  1154. X        bold = ((onechar && char1 == 'B') || char2 == 'B');
  1155. X        bolditalic = ((onechar && char1 == 'X') || char2 == 'X');
  1156. X
  1157. X        if (bold || bolditalic)
  1158. X        p->pkp_sw = 3;
  1159. X
  1160. X        if (italic || bolditalic)
  1161. X        p->pkp_style = 1;
  1162. X
  1163. X        /* This should be extended, but I don't have a good feeling
  1164. X           for troff typeface -> HPLJ nomenclature */
  1165. X        switch(char1) {
  1166. X        case 'H':
  1167. X            p->pkp_typeface = 4;    /* Helvetica */
  1168. X            break;
  1169. X        case 'C':
  1170. X            p->pkp_typeface = 3;    /* Courier */
  1171. X            break;
  1172. X        /* more? */
  1173. X        }
  1174. X    }
  1175. X    }
  1176. X
  1177. X    return(p);
  1178. X}
  1179. X
  1180. X#ifdef    SFP
  1181. X
  1182. X/*    Read an SFP header and convert it into the PK internal structure.
  1183. X */
  1184. Xstatic struct pkp *
  1185. Xpk_rsfp(p)
  1186. Xregister struct pkp *p; {
  1187. X    register int c;
  1188. X    int len;
  1189. X
  1190. X    if (fscanf(fin, ")s%dW", &len) != 1) {
  1191. X    pkmsg("SFP file %s: Bad CREATE FONT sequence\n", filename);
  1192. X    exit(1);
  1193. X    }
  1194. X
  1195. X    if (len < 26) {
  1196. X    pkmsg("SFP file %s: CREATE FONT sequence too short (%d)\n",
  1197. X        filename, len);
  1198. X    exit(1);
  1199. X    }
  1200. X
  1201. X    get2int();    /* 26 */
  1202. X    get1int();    /* 0 */
  1203. X    get1int();    /* 0 or 1 - forced 1 anyways */
  1204. X    get2int();    /* dummy */
  1205. X
  1206. X    p->pkp_bmax = get2int();    /* baseline */
  1207. X    p->pkp_wmax = get2int();    /* cell width */
  1208. X    p->pkp_dmax = get2int() - p->pkp_bmax;    /* cell height */
  1209. X
  1210. X    get1int();    /* 0 port, 1 land - forced 0 */
  1211. X    get1int();    /* fixed/proportional - forced proportional */
  1212. X
  1213. X    p->pkp_symset = get2int();
  1214. X
  1215. X    get2int();        /* pitch - we calculate this from height */
  1216. X    c = get2int();    /* retrieved *height* */
  1217. X    p->pkp_npts = c * POINT / (OUTRES*4) + .5;
  1218. X
  1219. X    get2int();    /* dummy */
  1220. X    get1int();    /* dummy */
  1221. X
  1222. X    p->pkp_style = get1int();
  1223. X    p->pkp_sw = get1int();
  1224. X    p->pkp_typeface = get1int();
  1225. X
  1226. X    p->pkp_xomax = 0;
  1227. X
  1228. X    /* These are simulated so that the PK handlers can figure the font out */
  1229. X    p->pkp_ds = p->pkp_npts * pow2(20);
  1230. X    p->pkp_cs = 0;
  1231. X    p->pkp_hppp = OUTRES * pow2(16) / POINT;
  1232. X    p->pkp_vppp = OUTRES * pow2(16) / POINT;
  1233. X    p->pkp_res = (double) p->pkp_hppp * POINT / pow2(16) + .5;
  1234. X
  1235. X    p->pkp_chars = (struct pkc *) NULL;
  1236. X    p->pkp_last = (struct pkc *) NULL;
  1237. X    p->pkp_num = 0;
  1238. X    p->pkp_list = (struct pkc **) NULL;
  1239. X
  1240. X
  1241. X    len -= 26;
  1242. X    while(len--)
  1243. X    getc(fin);
  1244. X    return(p);
  1245. X}
  1246. X#endif
  1247. X
  1248. Xstatic struct pkp *
  1249. Xreadhead() {
  1250. X    register struct pkp *p = (struct pkp *) mustmalloc(sizeof(struct pkp),
  1251. X    filename);
  1252. X    switch(getc(fin)) {
  1253. X    case PK_pre:
  1254. X        p->pkp_flags |= PK_PK;
  1255. X        return(pk_rpk(p));
  1256. X#ifdef    SFP
  1257. X    case 0x1b:
  1258. X        p->pkp_flags |= PK_SFP;
  1259. X        flag_byte = 0;
  1260. X        return(pk_rsfp(p));
  1261. X#endif
  1262. X    default:
  1263. X        fprintf(stderr, "PK file: %s don't know what it is!\n",
  1264. X        filename);
  1265. X        exit(1);
  1266. X    }
  1267. X    /*NOTREACHED*/
  1268. X}
  1269. X
  1270. Xpk_destroy(p)
  1271. Xregister struct pkp *p; {
  1272. X    register struct pkc *pc, *opc;
  1273. X    for (pc = p->pkp_chars; pc;) {
  1274. X    if (pc->pkc_pkr)
  1275. X        free((char *) pc->pkc_pkr);
  1276. X
  1277. X    if (pc->pkc_sfpr) {
  1278. X        free((char *) pc->pkc_sfpr->ras_raster);
  1279. X        free((char *) pc->pkc_sfpr);
  1280. X    }
  1281. X
  1282. X    opc = pc;
  1283. X    pc = opc->pkc_next;
  1284. X    free((char *) opc);
  1285. X    }
  1286. X    if (p->pkp_list)
  1287. X    free((char *) p->pkp_list);
  1288. X    free((char *) p);
  1289. X}
  1290. X
  1291. Xstruct pkp *
  1292. Xpk_read(file, fontcode)
  1293. Xchar *file; int fontcode; {
  1294. X    register struct pkp *p;
  1295. X    extern FILE *popen();
  1296. X    register struct pkc *pc, **pcp;
  1297. X#ifdef    COMPRESS
  1298. X    int compressed = 0;
  1299. X#endif
  1300. X    fin = (FILE *) NULL;
  1301. X    if (access(filename = file, 4) == 0)
  1302. X    fin = fopen(filename, "r");
  1303. X#ifdef    COMPRESS
  1304. X    else {
  1305. X    char buf[1024];
  1306. X    strcpy(buf, file);
  1307. X    strcat(buf, ".Z");
  1308. X    if (access(buf, 4) == 0) {
  1309. X        sprintf(buf, "%s %s.Z", COMPRESS, file);
  1310. X        fin = popen(buf, "r");
  1311. X        compressed = 1;
  1312. X    }
  1313. X    }
  1314. X#endif
  1315. X    if (!fin) {
  1316. X    pkmsg("Cannot open PK/SFP file %s\n", file);
  1317. X    exit(1);
  1318. X    }
  1319. X    p = readhead();
  1320. X    if (p->pkp_flags&PK_PK)
  1321. X    skipspecials();
  1322. X
  1323. X    while ((flag_byte != PK_post) && (pc = readchar(p))) {
  1324. X    DBP((D_VERB, "type: %s: %d\n", p->pkp_flags&PK_PK? "PK": "SFP",
  1325. X        pc->pkc_char));
  1326. X#ifdef    PARTIAL
  1327. X    if (!needchar(fontcode, pc->pkc_char)) {
  1328. X        DBP((D_FONT|D_PK, "Dropping char %02x from load\n", pc->pkc_char));
  1329. X
  1330. X        if (pc->pkc_pkr) {
  1331. X        free((char *) pc->pkc_pkr);
  1332. X        pc->pkc_pkr = (int8 *) NULL;
  1333. X        }
  1334. X
  1335. X        if (pc->pkc_sfpr) {
  1336. X        free((char *) pc->pkc_sfpr->ras_raster);
  1337. X        free((char *) pc->pkc_sfpr);
  1338. X        pc->pkc_sfpr = (struct ras *) NULL;
  1339. X        }
  1340. X
  1341. X        free((char *) pc);
  1342. X        if (p->pkp_flags&PK_PK)
  1343. X        skipspecials();
  1344. X        continue;
  1345. X    }
  1346. X#endif
  1347. X    DBP((D_FONT|D_PK, "Loading char %02x\n", pc->pkc_char));
  1348. X    p->pkp_num++;
  1349. X    pc->pkc_next = (struct pkc *) NULL;
  1350. X    if (!p->pkp_chars)
  1351. X        p->pkp_chars = pc;
  1352. X    if (p->pkp_last)
  1353. X        p->pkp_last->pkc_next = pc;
  1354. X    p->pkp_last = pc;
  1355. X    if (p->pkp_flags&PK_PK) {
  1356. X        p->pkp_bmax = max(p->pkp_bmax, pc->pkc_y_off);
  1357. X        p->pkp_dmax = max(p->pkp_dmax, pc->pkc_height - pc->pkc_y_off);
  1358. X        p->pkp_wmax = max(p->pkp_wmax, pc->pkc_width - pc->pkc_x_off);
  1359. X    }
  1360. X    p->pkp_xomax = min(p->pkp_xomax, pc->pkc_x_off);
  1361. X    if (pc->pkc_char == 'a') {
  1362. X        p->pkp_kh = pc->pkc_y_off;
  1363. X        p->pkp_kl = pc->pkc_y_off - pc->pkc_height;
  1364. X    }
  1365. X    if (p->pkp_flags&PK_PK)
  1366. X        skipspecials();
  1367. X    }
  1368. X    DBP((D_FONT|D_PK, "End of font\n"));
  1369. X#ifdef    COMPRESS
  1370. X    if (compressed) {
  1371. X    if (pclose(fin)) {
  1372. X        pkmsg("Decompression of %s failed\n", file);
  1373. X        exit(1);
  1374. X    }
  1375. X    } else
  1376. X#endif
  1377. X    fclose(fin);
  1378. X    pcp = p->pkp_list = (struct pkc **)
  1379. X    mustmalloc((int) (p->pkp_num * sizeof(struct pkc *)), filename);
  1380. X    for (pc = p->pkp_chars; pc; pc = pc->pkc_next)
  1381. X    *pcp++ = pc;
  1382. X    qsort(p->pkp_list, (unsigned) p->pkp_num, sizeof(struct pkc *), pkccomp);
  1383. X    return(p);
  1384. X}
  1385. X
  1386. X/*    Emit routines */
  1387. X
  1388. X/*    Emit a font descriptor in SFP format */
  1389. Xepk_desc(p, sfp)
  1390. Xregister struct pkp *p;
  1391. XFILE *sfp; {
  1392. X
  1393. X    fprintf(sfp, "\033)s26W");
  1394. X    fputshort(26, sfp);
  1395. X    fputc(0, sfp);
  1396. X    fputc(1, sfp);    /* font type 1 (33-127 && 160-255 printable) */
  1397. X    fputshort(0, sfp);
  1398. X    fputshort(p->pkp_bmax, sfp);    /* baseline position */
  1399. X    fputshort(p->pkp_wmax, sfp);    /* cell width */
  1400. X    fputshort(p->pkp_bmax + p->pkp_dmax, sfp);    /* cell height */
  1401. X    fputc(0, sfp);    /* portrait */
  1402. X    fputc(1, sfp);    /* proportional */
  1403. X
  1404. X    fputshort((long) p->pkp_symset, sfp);
  1405. X
  1406. X    fputshort((long) (OUTRES * p->pkp_npts * 4) / 120, sfp);
  1407. X    fputshort((long) (p->pkp_npts * (OUTRES / POINT) * 4), sfp);
  1408. X    fputshort(0, sfp);
  1409. X    fputc(0, sfp);
  1410. X    fputc(p->pkp_style, sfp);
  1411. X    fputc(p->pkp_sw, sfp);
  1412. X    fputc(p->pkp_typeface, sfp);
  1413. X
  1414. X}
  1415. X
  1416. Xfputshort(val, f)
  1417. XFILE *f;
  1418. Xlong val; {
  1419. X    fputc(((int) val >> 8) & 0xff, f);
  1420. X    fputc((int) val & 0xff, f);
  1421. X}
  1422. X
  1423. X
  1424. X/*    Emit a character descriptor in SFP format.
  1425. X    Notes: if this is a PK font, the PK raster is converted
  1426. X    to SFP format and dumpped.  If the font was originally
  1427. X    SFP format, it's dumpped directly.  In either event, epkc_desc
  1428. X    deletes the SFP raster *and* the PK raster (if the character
  1429. X    has one), meaning that once this routine has emitted a character,
  1430. X    you can't emit it again!  Which is why pkc's pkflush completely
  1431. X    destroys the font.  Why?  Well, SFP's can get rather large, and
  1432. X    it seems reasonable to get rid of them as quickly as possible.
  1433. X
  1434. X    Returns number of bytes emitted.
  1435. X */
  1436. Xepkc_desc(pc, sfp)
  1437. Xregister struct pkc *pc;
  1438. Xregister FILE *sfp; {
  1439. X    register struct ras *r;
  1440. X
  1441. X    if (!pc->pkc_pkr && !pc->pkc_sfpr) {
  1442. X    fprintf(stderr, "%s: already downloaded %02x\n", pc->pkc_char);
  1443. X    return(0);
  1444. X    }
  1445. X
  1446. X    /* Emit SET CHARACTER sequence */
  1447. X    fprintf(sfp, "\033*c%dE", pc->pkc_char);
  1448. X
  1449. X    /* Emit DOWNLOAD CHARACTER sequence */
  1450. X    fprintf(sfp, "\033(s%dW", 16 + ((pc->pkc_width + 7) / 8) *
  1451. X    pc->pkc_height);
  1452. X    fputc(4, sfp);
  1453. X    fputc(0, sfp);
  1454. X    fputc(14, sfp);
  1455. X    fputc(1, sfp);
  1456. X    fputc(0, sfp);        /* portrait */
  1457. X    fputc(0, sfp);
  1458. X    fputshort(-pc->pkc_x_off, sfp);
  1459. X    fputshort(pc->pkc_y_off, sfp);
  1460. X    fputshort(pc->pkc_width, sfp);
  1461. X    fputshort(pc->pkc_height, sfp);
  1462. X    fputshort(pc->pkc_dx * 4 / pow2(16), sfp);
  1463. X    r = pkrast(pc);
  1464. X
  1465. X    if (pc->pkc_pkr)
  1466. X    free((char *) pc->pkc_pkr);
  1467. X    pc->pkc_pkr = (int8 *) NULL;
  1468. X
  1469. X    if (r) {
  1470. X#ifdef    VDEBUG
  1471. X    dumpr(r, r->ras_ycur);
  1472. X#endif
  1473. X    fwrite((char *) r->ras_raster, 1, (int) ((pc->pkc_width + 7) / 8) *
  1474. X        (int) pc->pkc_height, sfp);
  1475. X    free((char *) r->ras_raster);
  1476. X    free((char *) r);
  1477. X    }
  1478. X    pc->pkc_sfpr = (struct ras *) NULL;
  1479. X    return(((pc->pkc_width + 7) / 8) * pc->pkc_height);
  1480. X}
  1481. X#endif
  1482. END_OF_FILE
  1483.   if test 21627 -ne `wc -c <'pk.c'`; then
  1484.     echo shar: \"'pk.c'\" unpacked with wrong size!
  1485.   fi
  1486.   # end of 'pk.c'
  1487. fi
  1488. if test -f 'tests/ltest.m' -a "${1}" != "-c" ; then 
  1489.   echo shar: Will not clobber existing file \"'tests/ltest.m'\"
  1490. else
  1491.   echo shar: Extracting \"'tests/ltest.m'\" \(8283 characters\)
  1492.   sed "s/^X//" >'tests/ltest.m' <<'END_OF_FILE'
  1493. X.\"Document revision 2.2 90/08/10
  1494. X.nr Ej 1
  1495. X.TL
  1496. Xtroff2ps testing script.
  1497. X.AU "Chris Lewis"
  1498. X.AS 1 10
  1499. XEver since the dawn of time, people have been dreaming of being
  1500. Xable to use "troff" on devices other than Wang Cat Phototypesetters.
  1501. XThis is a test document of one such thingie.
  1502. X.AE
  1503. X.MT 4 1
  1504. X.SP 2i
  1505. X.H 1 "Line Test"
  1506. X.P
  1507. XThis line should be exactly 5 inches long:
  1508. X.DS
  1509. X\l'5i\&\(ru'
  1510. X.DE
  1511. X.H 2 "Extended font test"
  1512. X.P
  1513. XExtended font test:
  1514. X.eX I
  1515. XThis is a standard display - this should be
  1516. XCourier, fixed width.
  1517. X.eE
  1518. X.H 2 "Simple paragraphs"
  1519. X.P
  1520. XThis is some more of the testing.  Can't you tell?
  1521. XTesting, testing, testing testing.
  1522. XThis book is a practical guide to the \fBUNIX\fP system and all users
  1523. Xfrom the novice to the expert should find it useful.
  1524. XMany examples are used throughout the text to illustrate techniques that make
  1525. Xthe system attractive to use.  By giving examples of the interactions
  1526. Xbetween commands, the user is able to take full advantage of the power of the
  1527. X\fBUNIX\fP system.
  1528. X.P
  1529. XThis is some more of the testing.  Can't you tell?
  1530. XTesting, testing, testing testing.
  1531. XThis book is a practical guide to the \fBUNIX\fP system and all users
  1532. Xfrom the novice to the expert should find it useful.
  1533. XMany examples are used throughout the text to illustrate techniques that make
  1534. Xthe system attractive to use.  By giving examples of the interactions
  1535. Xbetween commands, the user is able to take full advantage of the power of the
  1536. X\fBUNIX\fP system.
  1537. X.H 1 "Lists"
  1538. X.P
  1539. XBullet list:
  1540. X.BL
  1541. X.LI
  1542. X\(<- that was a bullet.
  1543. X.LI
  1544. XThis is 2
  1545. X.LI
  1546. XDashlist:
  1547. X.DL
  1548. X.LI
  1549. XDash
  1550. X.LI
  1551. XDasher
  1552. X.LE
  1553. X.LE
  1554. X.H 2 "Ligature test"
  1555. X.P
  1556. XLigature test: fido, flu, duffle, duffin
  1557. X.P
  1558. Xnroff doesn't like double quotes too much.
  1559. X"X" should look reasonable.
  1560. XMore 'test` `test'\*F
  1561. X.FS
  1562. XThis here's a footnote - slightly smaller pitch.
  1563. X.FE
  1564. XThis is more of the paragraph.
  1565. X.SK
  1566. X.H 1 "Different Fonts"
  1567. X.P
  1568. XThis is normal\f3Bold\fP\f2italic\fPnormal.
  1569. XThis is normal \f3Bold\fP \f2italic\fP normal.
  1570. X.S 36 38
  1571. X.P
  1572. X\(bs
  1573. X.S
  1574. X.S 14 26
  1575. X.P
  1576. Xthat was the logo at 36 point.  This sentence is 14 point.
  1577. X.S
  1578. X.P
  1579. XThe Logo will be printed whether or not you have raster fonts.
  1580. XThe original logo is a stylized "cX".
  1581. XIf you don't have the vfonts installed, the rest of the line will be
  1582. Xnormal characters with big spacing.
  1583. XIf the fonts are installed, you will see 75DPI big print.
  1584. X.P
  1585. XThis is some more of bigger stuff:
  1586. X.S 22
  1587. XTesting
  1588. X.I Testing
  1589. X.B Testing
  1590. X.S
  1591. X.SP
  1592. X.S 6
  1593. X6 Point
  1594. X.br
  1595. X.S 7
  1596. X7 Point
  1597. X.br
  1598. X.S 8
  1599. X8 Point
  1600. X.br
  1601. X.S 9
  1602. X9 Point
  1603. X.br
  1604. X.S 10
  1605. X10 Point
  1606. X.br
  1607. X.S 11
  1608. X11 Point
  1609. X.br
  1610. X.S 12
  1611. X12 Point
  1612. X.br
  1613. X.S 14
  1614. X14 Point
  1615. X.br
  1616. X.S 16
  1617. X16 Point
  1618. X.br
  1619. X.S 18
  1620. X18 Point
  1621. X.br
  1622. X.S 20
  1623. X20 Point
  1624. X.br
  1625. X.S 22
  1626. X22 Point
  1627. X.br
  1628. X.S 24
  1629. X24 Point
  1630. X.br
  1631. X.S 28
  1632. X28 Point
  1633. X.br
  1634. X.S 36
  1635. X36 Point
  1636. X.br
  1637. X.S 10
  1638. X.P
  1639. XNow, lets have some phun with phonts:
  1640. X.br
  1641. X.fp 1 H
  1642. X.fp 2 HO
  1643. X.fp 3 HB
  1644. X.ft 1
  1645. XThis should be Helvetica.
  1646. X\f2Helvetica Oblique\fP, \f3Helvetica Bold\fP.
  1647. X.br
  1648. X.fp 1 BR
  1649. X.fp 2 BO
  1650. X.fp 3 BB
  1651. X.ft 1
  1652. X.P
  1653. XThis should be Bookman.
  1654. X\f2Bookman Oblique\fP, \f3Bookman Bold\fP.
  1655. X.br
  1656. X.fp 1 R
  1657. X.fp 2 I
  1658. X.fp 3 B
  1659. X.H 3 "Testing 3"
  1660. Xhello 3
  1661. X.H 4 "Testing 4"
  1662. Xhello 4
  1663. X.H 5 "Testing 5"
  1664. Xhello 5
  1665. X.H 6 "Testing 6"
  1666. Xhello 6
  1667. X.H 7 "Testing 7"
  1668. Xhello 7
  1669. X.H 1 "Some Equations"
  1670. X.S 16
  1671. XEquations:
  1672. X.S
  1673. X.DS
  1674. X.EQ
  1675. Xleft [ x sup 2 + y sup 2 over alpha right ] ~=~ 1
  1676. X.EN
  1677. X.DE
  1678. X.br
  1679. X.DS
  1680. X.EQ
  1681. Xx dot = f(t) bar
  1682. X.EN
  1683. X.DE
  1684. X.DS
  1685. X.EQ
  1686. Xlim from {n -> inf} sum from 0 to n x sub i
  1687. X.EN
  1688. X.DE
  1689. X.DS
  1690. X.EQ
  1691. Xt ~=~ 2 pi int sub 0 sup 1
  1692. Xsin ( sqrt { x sup 2 + a sup 2 } ) dx
  1693. X.EN
  1694. X.DE
  1695. X.\".P
  1696. X.\"This is a test of piling (though, this isn't eqn):
  1697. X.\".DS I
  1698. X.\"\b'\(lt\(lk\(lb'\b'\(lc\(lf x \b'\(rc\(rf\b'\(rt\(rk\(rb'
  1699. X.\".DE
  1700. X.H 2 "More Equations"
  1701. X.DS
  1702. X.EQ
  1703. XG(z)~mark =~ e sup { ln ~ G(z) }
  1704. X~=~ exp left (
  1705. Xsum from k>=1 { S sub k z sup k } over k right )
  1706. X~=~ prod from k>=1 e sup { S sub k z sup k / k }
  1707. X.EN
  1708. X.DE
  1709. X.DS
  1710. X.EQ
  1711. Xlineup = left ( 1 + S sub 1 z +
  1712. X{ S sub 1 sup 2 z sup 2 } over 2! + ... right )
  1713. Xleft ( 1 + { S sub 2 z sup 2 } over 2
  1714. X+ { S sub 2 sup 2 z sup 4 } over { 2 sup 2 cdot 2! }
  1715. X+ ... right ) ...
  1716. X.EN
  1717. X.DE
  1718. X.DS
  1719. X.EQ
  1720. Xlineup = sum from m>=0 left (
  1721. Xsum from
  1722. Xpile { k sub 1 ,k sub 2 ,..., k sub m >= 0
  1723. Xabove
  1724. Xk sub 1 +2k sub 2 + ... + mk sub m = m }
  1725. X{ S sub 1 sup { k sub 1 } } over { 1 sup k sub 1 k sub 1 ! } ~
  1726. X{ S sub 2 sup { k sub 2 } } over { 2 sup k sub 2 k sub 2 ! } ~
  1727. X{ S sub m sup { k sub m } } over { m sup k sub m k sub m ! }
  1728. Xright ) z sup m
  1729. X.EN
  1730. X.DE
  1731. X.H 2 "Hanging Caps"
  1732. X.fp 1 PR
  1733. X.fp 3 PB
  1734. X.ta 1i
  1735. X.in +0.6i
  1736. X.ll -0.3i
  1737. X.ti -0.3i
  1738. X\v'1'\s36P\s0\v'-1'ater
  1739. X.de Xx
  1740. X'in -0.6i
  1741. X..
  1742. X.wh \n(nlu+1.5v Xx
  1743. Xnoster qui est
  1744. Xin caelis scanctificetur nomen tuum; adveniat regnum tuum;
  1745. Xfiat voluntus tua, sicut in caelo, et in terra ...
  1746. XAmen.
  1747. XToo bad I can't read Latin so I don't know what that line meant.
  1748. XBut it should be a good example of INITIAL hanging caps.
  1749. X(AND Palatino...)
  1750. X.fp 1 R
  1751. X.fp 3 B
  1752. X.H 1 "tbl output"
  1753. X.DS
  1754. X.TS
  1755. Xallbox doublebox;
  1756. Xc c c
  1757. Xl l l.
  1758. XCommand    Reference Section    Action
  1759. X
  1760. Xcc    CP    Compiles C programs
  1761. Xcp    C    Copies files
  1762. Xdisk cp    C    Copies archive media
  1763. Xlc    C    Lists files
  1764. Xlogin    M    Access to the system
  1765. Xtroff    CT    Typesets text
  1766. X.TE
  1767. X.DE
  1768. X.DS
  1769. X.TS
  1770. Xbox;
  1771. Xc s s
  1772. Xc | c | c
  1773. Xl | l | n.
  1774. XMajor New York Bridges
  1775. X=
  1776. XBridge    Designer    Length
  1777. X_
  1778. XBrooklyn    JA Roebling    1595
  1779. XManhattan    G Lindenthal    1470
  1780. XWilliamsburg    LL Buck    1600
  1781. X_
  1782. XQueensborough    Palmer &    1182
  1783. X      Hornbostel
  1784. X_
  1785. X        1380
  1786. XTriborough    OH Ammann    _
  1787. X        383
  1788. X_
  1789. XBronx Whitestone    OH Ammann    2300
  1790. XThrogs Neck    OH Ammann    1800
  1791. X_
  1792. XGeorge Washington    OH Ammann    3500
  1793. X.TE
  1794. X.DE
  1795. X.DS
  1796. X.TS
  1797. Xbox;
  1798. XcfB s s s.
  1799. XComposition of Foods
  1800. X_
  1801. X.T&
  1802. Xc | c s s
  1803. Xc | c s s.
  1804. XFood    Percent by Weight
  1805. X\^    _
  1806. X\^    Protein    Fat    Carbo-
  1807. X\^    \^    \^    hydrate
  1808. X_
  1809. X.T&
  1810. Xl | n | n | n.
  1811. XApples    .4    .5    13.0
  1812. XHalibut    18.4    5.2    ...
  1813. XLima beans    7.5    .8    22.o
  1814. XMilk    3.3    4.0    5.0
  1815. XMushrooms    3.5    .4    6.0
  1816. XRye bread    9.0    .6    52.7
  1817. X.TE
  1818. X.DE
  1819. X.H 1 "A Test of Two Column Output"
  1820. X.2C
  1821. X.P
  1822. XThe IBM salesman and the IBM system analyst went to spend
  1823. Xa weekend in the forest, hunting bear.
  1824. XThey hired a log cabin, and when they got there, took
  1825. Xtheir backpacks off and put them inside.
  1826. XAt which point the salesman said to the systems analyst:
  1827. X"You unpack while I go and find us a bear."
  1828. XThe analyst finished unpacking and then went and sat
  1829. Xoutside to await events. He did not have to wait too long.
  1830. XSoon he could hear noises in the forest. The noises got
  1831. Xnearer - and suddenly there was the salesman, running
  1832. Xacross the clearing toward the cabin, pursued by one of the
  1833. Xlargest and most ferocious Brown Bears the analyst had
  1834. Xever seen.
  1835. X"Open the door! shouted the salesman.
  1836. XThe analyst opened the door.
  1837. XThe salesman ran to the door, suddenly stopped, and
  1838. Xstepped aside.
  1839. XThe Bear carried by its momentum, continued though the
  1840. Xdoor and disappeared inside.
  1841. XThe salesman promptly shut the door on it, turned, looked
  1842. Xat the analyst, and said:
  1843. X"Ok, you skin that one while I go rustle us up another."
  1844. X.P
  1845. XThe IBM salesman and the IBM system analyst went to spend
  1846. Xa weekend in the forest, hunting bear.
  1847. XThey hired a log cabin, and when they got there, took
  1848. Xtheir backpacks off and put them inside.
  1849. XAt which point the salesman said to the systems analyst:
  1850. X"You unpack while I go and find us a bear."
  1851. XThe analyst finished unpacking and then went and sat
  1852. Xoutside to await events. He did not have to wait too long.
  1853. XSoon he could hear noises in the forest. The noises got
  1854. Xnearer - and suddenly there was the salesman, running
  1855. Xacross the clearing toward the cabin, pursued by one of the
  1856. Xlargest and most ferocious Brown Bears the analyst had
  1857. Xever seen.
  1858. X"Open the door! shouted the salesman.
  1859. XThe analyst opened the door.
  1860. XThe salesman ran to the door, suddenly stopped, and
  1861. Xstepped aside.
  1862. XThe Bear carried by its momentum, continued though the
  1863. Xdoor and disappeared inside.
  1864. XThe salesman promptly shut the door on it, turned, looked
  1865. Xat the analyst, and said:
  1866. X"Ok, you skin that one while I go rustle us up another."
  1867. X.P
  1868. XThe IBM salesman and the IBM system analyst went to spend
  1869. Xa weekend in the forest, hunting bear.
  1870. XThey hired a log cabin, and when they got there, took
  1871. Xtheir backpacks off and put them inside.
  1872. XAt which point the salesman said to the systems analyst:
  1873. X"You unpack while I go and find us a bear."
  1874. XThe analyst finished unpacking and then went and sat
  1875. Xoutside to await events. He did not have to wait too long.
  1876. XSoon he could hear noises in the forest. The noises got
  1877. Xnearer - and suddenly there was the salesman, running
  1878. Xacross the clearing toward the cabin, pursued by one of the
  1879. Xlargest and most ferocious Brown Bears the analyst had
  1880. Xever seen.
  1881. X"Open the door! shouted the salesman.
  1882. X.1C
  1883. X.CS
  1884. X.TC
  1885. END_OF_FILE
  1886.   if test 8283 -ne `wc -c <'tests/ltest.m'`; then
  1887.     echo shar: \"'tests/ltest.m'\" unpacked with wrong size!
  1888.   fi
  1889.   chmod +x 'tests/ltest.m'
  1890.   # end of 'tests/ltest.m'
  1891. fi
  1892. echo shar: End of archive 3 \(of 19\).
  1893. cp /dev/null ark3isdone
  1894. MISSING=""
  1895. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ; do
  1896.     if test ! -f ark${I}isdone ; then
  1897.     MISSING="${MISSING} ${I}"
  1898.     fi
  1899. done
  1900. if test "${MISSING}" = "" ; then
  1901.     echo You have unpacked all 19 archives.
  1902.     echo "Read the README to get started with psroff installation"
  1903.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1904. else
  1905.     echo You still must unpack the following archives:
  1906.     echo "        " ${MISSING}
  1907. fi
  1908. exit 0
  1909.  
  1910. exit 0 # Just in case...
  1911.